#define  _CRT_SECURE_NO_WARNINGS
#include "tree.h"
void PreOrder(struct TreeNode* root, int* ret, int* returnSize)
{
    if (root == NULL)
    {
        return;
    }
    ret[(*returnSize)++] = root->val;
    PreOrder(root->left, ret, returnSize);
    PreOrder(root->right, ret, returnSize);
}
int* preorderTraversal(struct TreeNode* root, int* returnSize)
{
    int* ret = (int*)malloc(sizeof(int) * 200);
    *returnSize = 0;
    PreOrder(root, ret, returnSize);
    return ret;
}
int main()
{
    struct TreeNode* root = CreatTree();
    LevelOrder(root);
    int size = 0;
    int* ans = preorderTraversal(root, &size);

    for (int i = 0; i < size; i++)
    {
        printf("%d ", ans[i]);
    }

    DestoryBiTree(root);
}